package com.augrain.microframework.lock.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * redis分布式锁相关配置
 *
 * @author biaoy
 * @since 2021/06/10
 */
@Getter
@Setter
@ConfigurationProperties(prefix = DLockConfig.PREFIX)
public class DLockConfig {
    public static final String PREFIX = "spring.mf.lock";

    // redisson
    private String address;
    private String password;
    private int database = 15;
    private ClusterServer clusterServer;
    private String codec = "org.redisson.codec.JsonJacksonCodec";

    // lock
    private long waitTime = 60;
    private long leaseTime = 60;
    private String globalPrefix = "";

    public static class ClusterServer {

        private String[] nodeAddresses;

        public String[] getNodeAddresses() {
            return nodeAddresses;
        }

        public void setNodeAddresses(String[] nodeAddresses) {
            this.nodeAddresses = nodeAddresses;
        }
    }
}
